package com.zy_demo;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.zygame.sdk.ConstantValue;
import com.zygame.sdk.view.dialog.ZY_BaseDialog;

/**
 * Created by YuXL on 2017/11/3.
 */

public class TestDialog extends ZY_BaseDialog {
    private IWXAPI api;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        api = WXAPIFactory.createWXAPI(context, ConstantValue.APP_ID,true);
//        api.registerApp(ConstantValue.APP_ID);
    }

    private Context context;
    public TestDialog(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    protected void init() {
        findViewById(R.id.btn).setOnClickListener(this);
    }

    @Override
    protected String getResourceStr() {
        return "tes";
    }

    @Override
    public void onClick(View v) {
        Toast.makeText(context,"DDDE",Toast.LENGTH_SHORT).show();
        final SendAuth.Req req = new SendAuth.Req();
                req.scope = "snsapi_userinfo";
                req.state = "wechat_sdk_demo_test";
                api.sendReq(req);
    }


}
